import {http} from "@/utils";

//获取频道
export function getChannelAPI(){
    return http({
        url:"/channels",
        method:"GET"
    })
}

//提交文章表单
export function createArticleAPI(data){
    return http({
        url:"/mp/articles?draft=false",
        method: "POST",
        data:data
    })
}

//获取文章列表
export function getArticlesAPI(params){
    return http({
        url:"/mp/articles",
        method:"GET",
        params:params
    })
}

//删除文章
export function DelArticleAPI(id){
    return http({
        url:`/mp/articles/${id}`,
        method:"DELETE"
    })
}

//获取文章详情
export function getArticleById(id){
    return http({
        url:`/mp/articles/${id}`,
        method:"GET"
    })
}

//更新数据
export function updateArticleAPI(data){
    return http({
        url:`/mp/articles/${data.id}?draft=false`,
        method:"PUT",
        data:data
    })
}
